package com.cxb.sentinel;

import com.cxb.FeignTest;;


import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class MyFallBackFactory implements FallbackFactory<FeignTest> {
    @Override
    public FeignTest create(Throwable cause) {
        log.error("远程调用异常");
        return new FeignTest() {
            @Override
            public void test() {
                log.info("test方法出现问题");
                throw new RuntimeException();

            }

            @Override
            public void demo2() {
                log.info("demo2方法出现问题");
                throw new RuntimeException();
            }

            @Override
            public void demo_3() {
                log.info("demo_3方法出现问题");
                throw new RuntimeException();
            }
        };
    }
}
